package com.xtx.air.web.action.login;

import com.xtx.air.bo.feature.IFeatureBO;
import com.xtx.air.dataobject.FeatureDO;
import com.xtx.air.web.action.BaseAction;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

import java.util.List;

public class MenuAction extends BaseAction {

    private List<FeatureDO> menu;
    private IFeatureBO featureBO;

    public String menu() {
        Subject currentUser = SecurityUtils.getSubject();
        List<String> permissions = (List<String>)currentUser.getSession().getAttribute("permission");
        menu = featureBO.findFeatureByPermissions(permissions);
        return SUCCESS;
    }

    public List<FeatureDO> getMenu() {
        return menu;
    }

    public void setMenu(List<FeatureDO> menu) {
        this.menu = menu;
    }

    public IFeatureBO getFeatureBO() {
        return featureBO;
    }

    public void setFeatureBO(IFeatureBO featureBO) {
        this.featureBO = featureBO;
    }
}
